<template>
	<el-upload
		:file-list="fileList"
		:class="className"
		:action="action"
		:multiple="multiple"
		:on-preview="handlePreview"
		:on-remove="handleRemove"
		:before-remove="beforeRemove"
		:limit="limit"
		:on-exceed="handleExceed"
	>
		<el-button type="primary">{{ btnText }}</el-button>
		<template #tip>
			<div class="el-upload__tip">{{ tip }}</div>
		</template>
	</el-upload>
</template>

<script lang="ts" setup>
defineProps({
	fileList: {
		type: Array,
		default: [],
	},
	action: {
		type: String,
		default: 'https://run.mocky.io/v3/9d059bf9-4660-45f2-925d-ce80ad6c4d15',
	},
	btnText: {
		type: String,
		default: '上传',
	},
	multiple: {
		type: Boolean,
		default: true,
	},
	className: {
		type: String,
		default: 'upload',
	},
	limit: {
		type: Number,
		default: 3,
	},
	tip: {
		type: String,
		default: '可选10MB以下大小的附件',
	},
});

const handlePreview = () => {};

const handleRemove = () => {};

const beforeRemove = () => {};

const handleExceed = () => {};
</script>
